﻿Imports System.Collections.ObjectModel
Imports OMANE.Common.Model.Interfaces
Imports Actuariat
Imports PTIC_GestionBDD
Imports PTIC_Util

Public Class TablesMaintienINCINVFactory
    Inherits TablesTravailFactory
    Implements Actuariat.ITablesMaintienINCINVFactory

    Public Sub New(ByVal InfosTables As ReadOnlyCollection(Of IInfoTableReferentiel),
                   ByVal ListeTraitements As ListeTraitementsBase(Of String))
        MyBase.New(InfosTables, ListeTraitements)
        m_ListeTablesMaintienINCINV = New Dictionary(Of IInfoTableReferentiel, ITableMaintienINCAPINVAL)
    End Sub

    Private m_ListeTablesMaintienINCINV As Dictionary(Of IInfoTableReferentiel, ITableMaintienINCAPINVAL)
    Public ReadOnly Property Item(ByVal NomTable As String) As Actuariat.ITableMaintienINCAPINVAL Implements Actuariat.ITablesMaintienINCINVFactory.Item
        Get
            Dim InfoTable As IInfoTableReferentiel =
                (From elt As IInfoTableReferentiel In InfosTables
                Select elt
                Where elt.NomTable = NomTable).ToList.FirstOrDefault

            If m_ListeTablesMaintienINCINV.ContainsKey(InfoTable) Then
                Return m_ListeTablesMaintienINCINV.Item(InfoTable)
            Else
                Dim Trait As TableBDD_SAS = Traitements(InfoTable)
                Dim DtbleINCINV As DataTable = Trait.execute_DataTableSortie(False)
                Dim ITableINCINV As ITableMaintienINCAPINVAL = New TableMaintienINCINVFromDataTable(InfoTable.NomTable, DtbleINCINV)
                m_ListeTablesMaintienINCINV.Add(InfoTable, ITableINCINV)
                Return ITableINCINV
            End If
        End Get
    End Property
#Region "Objet fortement typé"
    Public ReadOnly Property MaintienINCINV_CNP As Actuariat.ITableMaintienINCAPINVAL Implements Actuariat.ITablesMaintienINCINVFactory.MaintienINCINV_CNP
        Get

        End Get
    End Property
#End Region

End Class
